import requests

# 使用代理防止ip被封

if __name__ == "__main__":
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62"
    }
    responseText = requests.get(
        "https://www.sogou.com/web?query=ip",
        headers=headers,
        proxies={'http': 'http://198.59.147.147:8080'}).text
    with open("./file/ip.html", "w", encoding="utf-8") as fp:
        fp.write(responseText)
